# Maintainer: Carlos Antunes <cmantunes@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>

pkgname="lemon"
pkgver=3.21.0
pkgrel=1
pkgdesc="The LEMON LALR Parser Generator used in SQLite ${pkgver} (MSYS2)"
arch=('i686' 'x86_64')
license=(PublicDomain)
groups=('base-devel')
url="https://www.sqlite.org"
depends=("gcc-libs")
source=("lemon.c"
        "lempar.c"
        "0010-lemon-share.patch")
sha256sums=('573ef688d5a18fc0cfff2a3d6efcfc693e4d059328da631dabbfcdfa742ba6ee'
            '665efbf624b54408cabab7561a044d0fbc13c193078a96d491002167f2e4f42b'
            '9f71ba784e9ee5dbb514d2d5b15697bc707d9ffb195955208ceddf76b9e6e3eb')
options=("staticlibs")

prepare() {
  cd "${srcdir}"
  patch -Np0 -i ${srcdir}/0010-lemon-share.patch
}

build() {
  make lemon
}

package() {
  install -Dm755 lemon ${pkgdir}/usr/bin/lemon
  install -Dm644 lempar.c ${pkgdir}/usr/share/lemon/lempar.c
  mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
  echo "This package is under public domain." > "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
